package com.cloudlinkscm.loms.services.base.notify.dto.email.builder.component;

import com.cloudlinkscm.loms.services.base.notify.dto.email.EmailMessageDto;
import com.cloudlinkscm.loms.services.base.notify.dto.email.builder.EmailMessageDtoBuilder;
import com.cloudlinkscm.loms.services.base.notify.dto.email.builder.EmailMessageDtoBuilderDecorator;
import org.joda.time.DateTime;

import java.util.Date;

/**
 * @author : tac
 * @date : 2017/7/12
 */
public class EmailMessageDtoSendDateBuilderDecorator extends EmailMessageDtoBuilderDecorator {
    private DateTime dateTime;

    public EmailMessageDtoSendDateBuilderDecorator(EmailMessageDtoBuilder builder) {
        super(builder);
    }

    @Override
    public EmailMessageDto build() {
        return builder.build();
    }

    public EmailMessageDtoSendDateOffsetBuilderDecorator now(){
        this.dateTime = new DateTime();
        return next(dateTime);
    }
    public EmailMessageDtoSendDateOffsetBuilderDecorator at(Date date){
        this.dateTime = new DateTime(date);
        return next(dateTime);
    }

    private EmailMessageDtoSendDateOffsetBuilderDecorator next(DateTime dateTime){
        return new EmailMessageDtoSendDateOffsetBuilderDecorator(this, dateTime);
    }
    public EmailMessageDtoSettingsBuilderDecorator next(){
        return new EmailMessageDtoSettingsBuilderDecorator(this);
    }
}
